//
//  SetPointViewController.m
//  iRMAP
//
//  Created by Ryan Enguero on 4/2/14.
//  Copyright (c) 2014 engueroryan. All rights reserved.
//

#import "SetPointViewController.h"
#import "ParserClass.h"

@interface SetPointViewController (){
    NSString *setPointStr;
}

@end

@implementation SetPointViewController



- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithRed:0.0/255.0 green:30.0/255.0 blue:66.0/255.0 alpha:1.0], NSForegroundColorAttributeName,nil] forState:UIControlStateNormal];
        [self.navigationController.navigationBar setTintColor:[UIColor colorWithRed:0.0/255.0 green:30.0/255.0 blue:66.0/255.0 alpha:1.0]];
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.lblDegree1.text = [[ParserClass sharedItems] setPoint];
    self.lblDegree2.text = @"00";
    
    self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.0/255.0 green:30.0/255.0 blue:66.0/255.0 alpha:1.0];
    
    
    self.lblDegree1.layer.cornerRadius = 6;
    self.lblDegree2.layer.cornerRadius = 6;
    
    [self.tabBarController.tabBar setHidden:YES];
    
//    UIToolbar* numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
//    numberToolbar.barStyle = UIBarStyleBlackTranslucent;
//    numberToolbar.items = [NSArray arrayWithObjects:
//                           [[UIBarButtonItem alloc]initWithTitle:@"Cancel" style:UIBarButtonItemStyleBordered target:self action:@selector(cancelNumberPad)],
//                           [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],
//                           [[UIBarButtonItem alloc]initWithTitle:@"Apply" style:UIBarButtonItemStyleDone target:self action:@selector(doneWithNumberPad)],
//                           nil];
//    [numberToolbar sizeToFit];
//    self.txtDeg1.inputAccessoryView = numberToolbar;
//    self.txtDeg2.inputAccessoryView = numberToolbar;
    
        //[self.txtDeg1 setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];
    
    // Do any additional setup after loading the view from its nib.
}

-(void)viewWillAppear:(BOOL)animated{

    

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


-(void)cancelNumberPad{
    [self.txtDeg1 resignFirstResponder];
    //self.txtDeg1.text = @"";
    
    [self.txtDeg2 resignFirstResponder];
    //self.txtDeg2.text = @"";
}

-(void)doneWithNumberPad{
    [self.txtDeg1 resignFirstResponder];
    //self.txtDeg1.text = @"";
    
    [self.txtDeg2 resignFirstResponder];
    //self.txtDeg2.text = @"";
}

- (void)getSetPoint:(NSString *)setPoint{

    
    NSLog(@"setpoint = %@", setPoint);
    
    setPointStr = setPoint;
    
    self.txtDeg1.text = setPoint;

}

@end
